<template>
	<view>
		<cu-custom :isBack="true" bgColor="bg-theme text-white">
			<block slot="backText">返回</block>
			<block slot="content" >我的直播间</block>
		</cu-custom>
		
		
		<view class="cu-list menu">
			<view class="cu-item arrow">
				<view class="content">
					直播间名字
				</view>
				<view class="action">
					{{roominfo.name}}
				</view>
			</view>
			<view class="cu-item arrow">
				<view class="content">
					直播间标题
				</view>
				<view class="action">
					{{roominfo.title}}
				</view>
			</view>
			
			<view class="cu-item arrow">
				<view class="content">
					直播类型
				</view>
				<view class="action">
					{{roominfo.category.name}}
				</view>
			</view>
			
			<view class="cu-item arrow">
				<view class="content">
					直播封面
				</view>
			</view>
			<view class="poster_img radius bg-gray" >
				<cs-image class="" :option="roominfo.posterimage" ></cs-image>
			</view>
			
			
			
			<view class="padding">
				<button class="cu-btn block lg bg-theme" v-if="roominfo.status==1" @tap="gopush">开始直播</button>
				<button class="cu-btn block lg line-theme" v-if="roominfo.status==0" >直播申请审核中</button>
				<button class="cu-btn block lg line-theme" v-if="roominfo.status==2" >直播间已被封</button>
			</view>
			
			
		</view>
	</view>
</template>

<script>
	import csImage from '@/components/cs-image.vue'
	export default {
		components:{
			csImage
		},
		data() {
			return {
				roominfo:false
			}
		},
		onLoad(e) {
			if(e.query){
				this.roominfo = JSON.parse(decodeURIComponent(e.query))
			}
			this.getmyroom()
		},
		methods: {
			gopush(){
				uni.navigateTo({
					url:'/pages/push/push?query='+encodeURIComponent(JSON.stringify(this.roominfo))
				})
			},
			getmyroom(){
				this.util.csAjax('/addons/live/api.room/myroom',{},(ret)=>{
					console.log(ret)
					this.roominfo = ret.data
				})
			}
		}
	}
</script>

<style>
	.poster_img{
		width: 750rpx;
		height: 300rpx;
	}
</style>
